###################### GRAPHS FOR THEORY PART

setwd("...")

pdf("discon.pdf")

step <- stepfun(1, c(1,2))
plot(step, ylim=c(0,3), ylab=expression('Outcome (Y'[i]*')'), xlab=expression('Treatment intensity (T'[i]*')'), main="", yaxt="n", xaxt="n", lwd=2, bty="l", do.points=F)
axis(side=1, at=c(1,1.02), labels=c("k","k+1"))
axis(side=2, at=c(1), labels=expression('Y'[i](k)))
axis(side=2, at=c(2), labels=expression('Y'[i](k+1)))
abline(v=1,lty=2)
abline(v=1.02,lty=2)

dev.off()


pdf("linear.pdf")

step <- stepfun(c(1,2,3,4), c(1,2,3,4,5))
plot(step, xlim=c(0,4), ylim=c(0,5), ylab=expression('Outcome (Y'[i]*')'), xlab=expression('Treatment intensity (T'[i]*')'), main="", yaxt="n", xaxt="n", lwd=2, bty="l", do.points=F)
axis(side=1, at=c(0,1,2,3,4,5), labels=c("0","1","2","3","4","5"))
axis(side=2, at=c(1), labels=expression('Y'[i](0)))
axis(side=2, at=c(2), labels=expression('Y'[i](0)+tau))
axis(side=2, at=c(3), labels=expression('Y'[i](0)+2*tau))
axis(side=2, at=c(4), labels=expression('Y'[i](0)+3*tau))
axis(side=2, at=c(5), labels=expression('Y'[i](0)+4*tau))

dev.off()


pdf("nonlinear.pdf")

step <- stepfun(c(1,2,3,4), c(0.3,1.5,4,5.4,6))
plot(step, xlim=c(0,4), ylim=c(0,6), ylab=expression('Outcome (Y'[i]*')'), xlab=expression('Treatment intensity (T'[i]*')'), main="", yaxt="n", xaxt="n", lwd=2, bty="l", do.points=F)
axis(side=1, at=c(0,1,2,3,4,5), labels=c("0","1","2","3","4","5"))
axis(side=2, at=c(0.3), labels=expression('Y'[i](0)))
axis(side=2, at=c(1.5), labels=expression('Y'[i](1)))
axis(side=2, at=c(4), labels=expression('Y'[i](2)))
axis(side=2, at=c(5.4), labels=expression('Y'[i](3)))
axis(side=2, at=c(6), labels=expression('Y'[i](4)))

dev.off()



